<?php

use Hyperf\Database\Schema\Schema;
use Hyperf\Database\Schema\Blueprint;
use Hyperf\Database\Migrations\Migration;

return new class extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('inspection_exception', function (Blueprint $table) {
            $table->comment('临时巡检');
            $table->bigIncrements('id')->comment('ID');
            $table->tinyInteger('type')->nullable(false)->comment('1故障2告警');
            $table->dateTime('date')->nullable(false)->comment('异常时间');
            $table->string('content', 255)->nullable(false)->comment('事件内容/描述');
            $table->tinyInteger('status')->nullable(false)->comment('处理状态 1已处理 2未处理 3已接收');
            $table->json('inspector')->nullable(false)->comment('巡检人');
            $table->json('devices')->nullable(false)->comment('巡检设备');
            $table->dateTime('start_time')->nullable(false)->comment('巡检开始时间');
            $table->dateTime('end_time')->nullable(false)->comment('巡检结束时间');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('inspection_exception');
    }
};